package com.example.dbsample.model.bo;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Getter
@AllArgsConstructor
public enum OperateType {
    INSERT("1", "新增"),
    UPDATE("2", "修改"),
    SAVE_OR_UPDATE("3", "修改/新增"),
    DELETE("0", "删除"),
    CANCEL("6", "整批撤销"),
    PAUSE_OR_RESUME("7", "暂停/恢复拨打"),
    COPY("17", "复制策略"),
    ;
    private final String code;

    private final String desc;

    // 需要凭借修改内容的
    public static List<String> needAddChange() {
        return Arrays.asList(OperateType.INSERT.desc);
    }

    public static List<OperateType> updateType() {
        return Arrays.asList(OperateType.UPDATE, OperateType.SAVE_OR_UPDATE);
    }

    public static List<OperateType> specialHandleType() {
        return Arrays.asList(OperateType.CANCEL, OperateType.COPY);
    }

    public static List<String> getList() {
        List<String> list = new ArrayList<>();
        for(OperateType value : values()) {
            if(value.getCode().equals("7") || value.getCode().equals("3")) {
                continue;
            }
            list.add(value.getDesc());
        }
        return list;
    }

    public static List<OperateType> manyOperateWithOneType() {
        return Arrays.asList(OperateType.SAVE_OR_UPDATE, OperateType.PAUSE_OR_RESUME);
    }
}
